package com.example.mybus.dao;

import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;

import com.example.mybus.model.Micro;
import com.example.mybus.model.pmf.PMF;


public class MicroDao {
	
	public static Micro getMicroByPatente(String patente, PersistenceManager pm){

		Micro micro = (Micro)pm.getObjectById(Micro.class, patente);

		return micro;
	}
	
	public static List<Micro> getAll(){
		PersistenceManager pm = PMF.get().getPersistenceManager();
		Query q = pm.newQuery(Micro.class);
		List<Micro> results = (List<Micro>) q.execute();
		return results;
	}
}
